<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>设置公开权限</title>
	<link href="${pageContext.request.contextPath}/views/js/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
	<style>
		.filecharacter p{
			font-size: 12px;
			line-height: 60px;
			color: #666;
		}
		.filecharacter div{
		}
		.filecharacter div input{
			margin-top: 2px;
			margin-top: -1px \0;
			margin-left: 20px;
			float: left;
		}
		.filecharacter div label{
			float: left;
			margin-left: 10px;
			color: #666;
		}
		.filecharacter .filecharacter_btn a{
			width: 80px;
			height: 30px;
			line-height: 30px;
			background: #346bd0;
			text-align: center;
			color: #fff;
			border: 1px solid #346bd0;
			margin-top: 30px;
			cursor: pointer;
		}
		.filecharacter .filecharacter_btn .file_right_btn{
			border: 1px solid #346bd0;
			background: #fff;
			color: #346bd0;
		}
	</style>
	<script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/core/base.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
	<script src="${pageContext.request.contextPath}/views/js/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
</head>

<body>
	<input type="hidden" id="selid" value="${selid }">
	<input type="hidden" id="fileCharacter_str" value="${fileCharacter }">
	<table align="center" width="200" class="filecharacter">
		<tr>
			<td>
				<p>请选择是否公开文件：</p>
				<div>
					<input type="checkbox" id="fileCharacter" />
					<label for="fileCharacter">公开文件</label>
				</div>
			</td>
		</tr>
		<tr class="filecharacter_btn">
			<td align="center" colspan="2">
				<a class="l-button" style="float: left;" onclick="ajaxRenameFile();">确定</a>
				<a class="r-button file_right_btn" style="float: right;" onclick="cancel();">取消</a>
			</td>
		</tr>
	</table>
</body>
<script type="text/javascript">
	$(document).ready(function() {
		var fileCharacter = '${fileCharacter }';
		if (fileCharacter == '0') {
			$('#fileCharacter').attr("checked", "checked");
		}
	});
	var dialog = frameElement.dialog;

	function cancel() {
		dialog.close(); //关闭dialog 
	}

	function confirmRename() {
		var newFileName = $("#newFileName").val();
		var oldFileName = $("#oldFileName").val();
		if (newFileName == '') {
			$.ligerDialog.alert('文件名称不能为空!');
			return;
		}
		if (newFileName.match(/[\/\\"<>\?\*|]/)) {
			$.ligerDialog.alert('文件名称不合法!');
			return;
		}
		if (newFileName == oldFileName) {
			$.ligerDialog.alert('新名称不能和旧名称相同!');
			return;
		}
		$.ligerDialog.confirm('确认修改名称？', function(yes) {
			if (yes == true) {
				ajaxRenameFile();
			}
		});
	}

	function ajaxRenameFile() {
		var fileCharacter = "1";
		if ($('#fileCharacter').is(':checked')) {
			fileCharacter = "0";
		}
		var selid = '${selid }';

		$.ajax({
			type: 'post',
			url: '${pageContext.request.contextPath}/file/ajaxchangecharacter',
			dataType: 'json',
			data: {
				'fileCharacter': fileCharacter,
				'selid': selid
			},
			success: function(rtn) {
				if (rtn.code == '0') {
					parent.BindData();
					parent.$.ligerDialog.close();
					parent.operationTips('修改成功！');
				} else {
					$.ligerDialog.alert(rtn.msg);
				}
			},
			error: function(xhr, status, error) {
				alert(error);
			}
		});
	}
</script>

</html>